﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Profil.aspx.cs" Inherits="CPETwit.Web.Pages.Profil" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html data-nav-highlight-class-name="highlight-global-nav-home">
<head>
    <title>CPE Tweet - Votre Profil</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="res/css/t1_core.css" type="text/css" media="screen">
    <link rel="stylesheet" href="res/css/js-user-style.css" type="text/css" media="screen">
    <script type="text/javascript" src="res/js/head_logged_out.js"></script>
    <script type="text/javascript" src="res/js/jquery-1.7.1.min.js"></script>
    <!-- ppTextArea Plugin -->
    <script type="text/javascript" src="res/js/jquery.ppTextarea.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#TweetPost').ppTextarea({
                min: 00,
                max: 140,
                idMeter: 'tweet-counter',
                textMeter: '',
                idCheck: '',
                imgYes: '',
                imgNo: '',
                stop: true
            });
        }); 
    </script>
</head>
<%@ import namespace="CPETwit.Data.Entity" %>
<% 
    /* Traitement du design
     * Sexe masculin => design bleu, 
     * féminin => design rose 
     */
    switch (((User)Session["login"]).sex)
    {
        case "M":
            Response.Write("<body class='body-male'>");
            break;
        case "F":
            Response.Write("<body class='body-female'>");
            break;
    }
%>
<form runat="server" id="form1">
<div id="doc">
    <div class="topbar js-topbar">
        <div id="banners" class="js-banners">
            <noscript>
                <div class="banner-outer">
                    <div class="banner">
                        <div class="banner-inside noscript-warning">
                            <h5>
                                Twitter.com fait un usage intensif de JavaScript.</h5>
                            <span class="warning">Si vous ne pouvez pas l'activer dans les préférences de votre
                                navigateur, vous pourriez avoir une meilleure expérience sur notre <a href="http://m.twitter.com">
                                    site mobile</a>.</span>
                        </div>
                    </div>
                </div>
            </noscript>
            <div class="banner-outer" id="slow-load-banner">
                <div class="banner">
                    <div class="banner-inside slow-warning">
                        <h5>
                            Twitter.com se charge lentement.</h5>
                        <span class="warning">Hum, il semblerait que cela prenne un certain temps. Si les problèmes
                            persistent, <a href="javascript:window.location.reload(true);">rafraichissez la page</a>
                            ou réessayez.</span>
                    </div>
                </div>
            </div>
        </div>
        <div class="global-nav" data-section-term="top_nav">
            <div class="global-nav-inner">
                <div class="container">
                    <ul class="nav js-global-actions" id="global-actions">
                        <li id="global-nav-home" class="home" data-global-action="home"><a class="js-hover"
                            href="timeline.aspx" data-component-term="home_nav"><span class="new-wrapper"><i
                                class="nav-home"></i><i class="nav-new"></i></span>Accueil </a></li>
                        <li class="people" data-global-action="connect"><a class="js-hover" href="following.aspx"
                            data-component-term="connect_nav"><span class="new-wrapper"><i class="nav-people"></i>
                                <i class="nav-new"></i></span>Connecter </a></li>
                        <li class="people active" data-global-action="connect"><a class="js-hover" href="profil.aspx"
                            data-component-term="connect_nav"><span class="new-wrapper"><i class="nav-me"></i><i
                                class="nav-new"></i></span>Profil </a></li>
                        <li class="people" data-global-action="connect"><a class="js-hover" href="apropos.aspx"
                            data-component-term="connect_nav"><span class="new-wrapper"><i class="nav-topics"></i>
                                <i class="nav-new"></i></span>A Propos </a></li>
                    </ul>
                    <i class="cpetweet-topbar"></i>
                </div>
            </div>
        </div>
        <div class="alert-messages" id="message-drawer">
        </div>
    </div>
    <div id="page-outer">
        <div id="page-container" class="wrapper">
            <div id="page-node-home">
                <div class="js-content-top">
                    <div class="module profile-card component" data-component-term="profile_follow_card">
                        <div class="flex-module clearfix ">
                            <a target="_blank" class="profile-picture" href="#">
                                    <%
                                        if (this.currentUser.avatar != null)
                                        {
                                            /* Avatar de l'utilisateur */
                                            Response.Write(String.Format("<img class='avatar size128' id='avatar_preview' src='ImgHandler.ashx?login={0}' />", this.currentUser.login));
                                        }
                                        else
                                        {
                                            /* Avatar par défaut */
                                            Response.Write("<img class='avatar size128' id='avatar_preview' src='res/img/hf128.png' />");
                                        }
                                        
                                         %>
                            </a>
                            <div class="profile-card-inner js-actionable-user">
                                <h1 class="fullname">
                                    <% Response.Write(currentUser.name); %></h1>
                                <h2 class="username">
                                    <span class="js-username"><span class="screen-name"><s>@</s><% Response.Write(currentUser.login); %> </span></span></h2>
                                <p class="location-and-url">
                                    <span class="location">
                                        <% Response.Write(currentUser.email); %>
                                    </span>
                                </p>
                                <p class="bio">
                                    <% Response.Write(currentUser.description); %>
                                </p>
                            </div>
                            <div class="profile-card-actions js-profile-card-actions">
                                <div class="follow-btn-container">
                                    <!--<a href="profil_edit.aspx" class="btn js-thats-you edit-profile-btn">Éditer votre profil</a>-->
                                    <%
                                        if (this.currentUser != null && ((User)Session["login"]).login.Equals(this.currentUser.login))
                                        {
                                            Response.Write("<a  href='profil_edit.aspx' class='btn js-thats-you edit-profile-btn'>Éditer votre profil</a>");
                                        }
                                    %>
                                </div>
                                <ul class="stats js-mini-profile-stats">
                                    <li><a data-element-term="tweet_stats" href="#"><strong>
                                        <asp:label runat="server" text="0" id="nb_tweet_profil"></asp:label>
                                    </strong>Tweets</a> </li>
                                    <li><a data-element-term="following_stats" href="#"><strong>
                                        <asp:label runat="server" text="0" id="nb_abonnement_profil"></asp:label>
                                    </strong>Abonnements</a> </li>
                                    <li><a data-element-term="follower_stats" href="#"><strong>
                                        <asp:label runat="server" text="0" id="nb_abonne_profil"></asp:label>
                                    </strong>Abonnés</a> </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="dashboard">
                    <div id="js-promptbird-dashboard-narrow-hook" data-component-term="promptbird_dashboard_placeholder"
                        class="component">
                    </div>
                    <div data-component-term="mini_home_profile" class="module mini-profile component">
                        <div class="flex-module profile-summary js-profile-summary">
                            <a href='profil.aspx' class="account-summary account-summary-small">
                                <div class="content">
                                    <div class="account-group js-mini-current-user">
                                       <%
                                        if (((User)Session["login"]).avatar != null)
                                        {
                                            /* Avatar de l'utilisateur */
                                            Response.Write("<img class='avatar size32' id='avatar_preview' src='ImgHandler.ashx?login=" + ((User)Session["login"]).login + "' />");
                                        }
                                        else
                                        {
                                            /* Avatar par défaut */
                                            Response.Write("<img class='avatar size32' id='avatar_preview' src='res/img/hf32.png' />");
                                        }
                                        
                                         %>
                                        <b class="fullname">
                                            <% Response.Write(((User)Session["login"]).name); %></b> <small class="metadata">Voir
                                                ma page de profil</small>
                                    </div>
                                </div>
                            </a>
                        </div>
                        <div class="js-mini-profile-stats-container">
                            <ul class="stats js-mini-profile-stats">
                                <li><a href="profil.aspx" data-element-term="tweet_stats"><strong>
                                    <asp:label runat="server" text="0" id="nb_tweet"></asp:label>
                                </strong>Tweets</a> </li>
                                <li><a href="following.aspx" data-element-term="following_stats"><strong>
                                    <asp:label runat="server" id="nb_abonnement" text="Label"></asp:label>
                                </strong>Abonnements</a> </li>
                                <li><a href="followers.aspx" data-element-term="follower_stats"><strong>
                                    <asp:label runat="server" id="nb_abonne" text="Label"></asp:label>
                                </strong>Abonnés</a> </li>
                            </ul>
                        </div>
                        <!--<div class="component tweet-user tweetbox-placeholder"></div>-->
                        <div class="tweet-box tweet-user">
                            <div class="tweet-box">
                                <div class="text-area">
                                    <div class="text-area-editor twttr-editor closing">
                                        <asp:textbox id="TweetPost" runat="server" cssclass="twitter-anywhere-tweet-box-editor"
                                            textmode="MultiLine"></asp:textbox>
                                        <ul style="width: 274px; top: 87px; left: 0px; visibility: hidden;" class="autocomplete-container">
                                        </ul>
                                    </div>
                                </div>
                                <div class="tweet-button-container">
                                    <div class="tweet-button-sub-container">
                                        <asp:linkbutton id="DisconnectButton" runat="server" onclick="DisconnectButton_Click"
                                            cssclass="metadata">Se déconnecter</asp:linkbutton>
                                        <span class="metadata">| Twitter ?
                                            <asp:checkbox id="CheckBox_twitterizer" runat="server" text="" cssclass="metadata" />
                                        </span><span style="opacity: 0;" class="tweetbox-counter-tipsy"></span>
                                        <div class="tweet-counter" id="tweet-counter">
                                            140</div>
                                        <asp:linkbutton id="TweetButton" runat="server" text="Tweeter" onclick="TweetButton_Click"
                                            cssclass="tweet-button btn primary-btn"></asp:linkbutton>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div data-component-term="footer" class="component">
                        <div class="module site-footer ">
                            <div class="flex-module">
                                <div class="flex-module-inner js-items-container">
                                    <ul class="clearfix">
                                        <li class="copyright">© 2012 CPE Tweet by CPE School. See "A Propos" section for more
                                            details. </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="content-main js-content-main breakable">
                    <div id="js-promptbird-below-black-bar-hook">
                    </div>
                    <div id="js-empty-timeline-recommendations-module-hook">
                    </div>
                    <div class="content-header js-stream-header">
                        <div class="header-inner">
                            <h2>
                                <span class="content-header-buttons js-header-button-container"></span><span class="js-stream-title">
                                    Tweets</span><small class="view-toggler js-view-toggler"></small></h2>
                        </div>
                    </div>
                    <div class="stream js-stream-manager-container">
                        <div class="stream-manager js-stream-manager-container" id="home-stream-manager">
                            <div class="stream-title">
                            </div>
                            <div class="stream-container">
                                <div class="stream home-stream">
                                    <div class="js-stream-items stream-items" id="stream-items-id">
                                        <!-- DEBUT TEMPLATE TWEET -->
                                        <asp:listview id="ListViewFollowers" runat="server" datasourceid="ObjectDataSourceProfilTimeline"
                                            onitemcreated="ObjectDataSourceProfilTimeline_Created">
                                            <EmptyDataTemplate>
                                                <div class="js-stream-item stream-item stream-item expanding-stream-item">
                                                    <span class="metadata">Pas encore de tweets l'ami !</span>
                                                </div>
                                            </EmptyDataTemplate>
                                            <ItemTemplate>
                                                <div class="js-stream-item stream-item stream-item">
                                                    <div class="tweet original-tweet js-stream-tweet js-actionable-tweet js-hover js-profile-popup-actionable js-original-tweet">
                                                        <i class="dogear"></i>
                                                        <div class="content">
                                                            <div class="stream-item-header">
                                                                <a class="account-group js-account-group js-action-profile js-user-profile-link"
                                                                    href='profil.aspx?login=<%# Eval("UserFromProperty.login") %>' visible='<%# Eval("UserFromProperty.login") != null ? true : false %>'>
                                                                <a class="account-group js-account-group js-action-profile js-user-profile-link"
                                                                    href='profil.aspx?login=<%# Eval("CreatorProperty.login") %>' visible='<%# Eval("UserFromProperty.login") == null ? true : false %>'>
                                                                    <img class="avatar js-action-profile-avatar" src="res/img/hf48.png"
                                                                        runat="server" visible='<%# Eval("CreatorProperty.avatar") == null ? true : false %>'>
                                                                    <img id="avatar" class="avatar js-action-profile-avatar" src='<%# "ImgHandler.ashx?login=" + Eval("creatorProperty.login") %>'
                                                                        runat="server" visible='<%# (Eval("creatorProperty.avatar") != null ) ? true : false %>' />
                                                                    <strong class="fullname js-action-profile-name"><%# Eval("CreatorProperty.name") %></strong> <span class="username js-action-profile-name">
                                                                        <s>@</s><b><%# Eval("CreatorProperty.login") %></b> </span></a><small class="time"><a href="#" class="tweet-timestamp js-permalink">
                                                                            <span class="_timestamp"></span></a></small>
                                                                            <%# SecondsRemaining(Eval("tweetdate") as DateTime?)%>
                                                                    <ul class="actions js-actions">
                                                                        <!--<li class="action-reply-container"><i class="action-reply"></i>
                                                                            <asp:LinkButton ID="ReplyLink" CssClass="with-icn js-toggle-rt" runat="server" Text="Répondre" />
                                                                        </li>-->
                                                                        <li id="Li1" runat="server" visible='<%# Eval("TwitterProperty.login") != (((User)Session["login"]).login ) ? true : false %>' class="action-rt-container"><i class="action-rt"></i>

                                                                            <asp:LinkButton  ID="HyperLink1" CssClass="with-icn js-toggle-rt" CommandArgument='<%# Eval("id") %>'
                                                                                runat="server" Text="Retweeter" OnClick="test" />
                                                                        </li>
                                                                        <li class="action-del-container"><a class="with-icn js-action-del" href="#" title="Supprimer">
                                                                            <i class="action-del"></i><b>Supprimer</b> </a></li>
                                                                    </ul>
                                                            </div>
                                                            <p class="js-tweet-text">
                                                                <%# parseTweet(Eval("MessageProperty.contenu") as string) %>
                                                            </p>
                                                            <div class="stream-item-footer">
                                                                <div class="context" runat="server" visible='<%# Eval("UserFromProperty.name") != null ? true : false %>'>
                                                                    <span class="with-icn"><i class="sm-rt"></i>Retweeté par <a class="pretty-link js-user-profile-link"
                                                                        href="#"><b><%# Eval("TwitterProperty.name") %></b></a> </span>
                                                                </div>
                                                                <a class="details with-icn js-details" href="#"><span class="js-icon-container"></span>
                                                                    <b><span class="view-open js-view-details"></span><span class="hide-open js-hide-details">
                                                                    </span></b></a>
                                                            </div>
                                                            <div class="expanded-content js-tweet-details-dropdown">
                                                                <div class="js-tweet-details-fixer">
                                                                    <div class="js-tweet-media-container">
                                                                    </div>
                                                                    <div class="js-tweet-stats-container tweet-stats-container ">
                                                                    </div>
                                                                    <div class="client-and-actions">
                                                                        <span class="metadata"><span title=""></span><span>via <a href="#" rel="nofollow">Tweet
                                                                            Button</a></span> &middot; <a class="permalink-link js-permalink" href="#">Détails</a>
                                                                        </span>
                                                                        <ul class="actions js-actions">
                                                                            <li class="action-reply-container"><a class="with-icn js-action-reply" data-modal="tweet-reply"
                                                                                href="#" title="Répondre"><i class="action-reply"></i><b>Répondre</b> </a></li>
                                                                            <li class="action-rt-container"><a class="with-icn js-toggle-rt" data-modal="tweet-retweet"
                                                                                href="#"><i class="action-rt"></i><b><span class="undo-retweet" title="Annuler le retweet">
                                                                                    Retweeté</span><span class="retweet" title="Retweeter">Retweeter</span></b>
                                                                            </a></li>
                                                                        </ul>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </ItemTemplate>
                                            <layouttemplate>
                                                <div id="itemPlaceholderContainer" runat="server" style="">
                                                    <span runat="server" id="itemPlaceholder" />
                                                </div>
                                            </layouttemplate>
                                        </asp:listview>
                                        <!-- FIN TEMPLATE TWEET -->
                                        <asp:objectdatasource id="ObjectDataSourceProfilTimeline" runat="server" selectmethod="GetAllTweetsByUserId"
                                            typename="CPETwit.Web.Service.Implementation.TwitterService" onselecting="ObjectDataSourceProfilTimeline_Selecting">
                                            <SelectParameters>
                                                <asp:parameter name="id" type="Object" />
                                            </SelectParameters>
                                        </asp:objectdatasource>
                                    </div>
                                </div>
                            </div>
                            <div class="stream-loading">
                                <div class="stream-end-inner">
                                    <asp:linkbutton onclick="DisconnectButtonProfil_Click" runat="server" id="DisconnectButtonProfil">Se déconnecter</asp:linkbutton>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="twttr-dialog-wrapper">
</div>
</form>
<script type="text/javascript" src="res/js/foot_logged_out.js"></script>
</body>
</html>
